﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace CloseProgramByPort
{
    public class ResourceLoader
    {
        public static Icon LoadAppIcon()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            string resourceName = "CloseProgramByPort.Resources.appicon.ico";

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            {
                if (stream == null)
                    throw new InvalidOperationException("图标资源未找到，请检查命名空间和文件名");

                return new Icon(stream);
            }
        }
    }
}
